"""
Created on 2011-06-02

@author: Olivier
"""

class Direction(object):
    """
    classdocs
    """
    IN = "IN"
    OUT = "OUT"
    BOTH = "BOTH"
    UNCONNECTED = "X"
    
    DIRECTIONS = ["IN","OUT","BOTH","X"]
    
    _dir = UNCONNECTED

    def __init__(self, direction = "X"):
        """
        Constructor
        """
        self.setDirection(direction)
        
    def _isValidDirection(self, dir=""):
        """
        """
        if dir in self.DIRECTIONS:
            return True
        return False
    
    def setDirection(self, direction):
        """
        """
        if self._isValidDirection(direction):
            self._dir = direction
        else:
            raise ValueError("Invalid direction")
        
    def getDirection(self):
        return self._dir
        